package a.f.h.a;

import a.c.bb;
import a.c.e;
import a.c.n;
import a.c.w;
import a.d.s;
import a.f.c.h;
import a.f.*;
import a.f.h.a.b.p;
import a.i.db;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

public class c
  extends mb
{
  private a.f.h.a.a.b w = null;
  private a.f.h.a.b.b x;
  private a.f.o y;
  private int z;
  private int A = 1;
  private boolean B = true;
  private boolean C = true;
  private a.c.ab D;
  private bb E;
  private a.f.h.k F;
  private boolean G = true;
  public static boolean H;
  
  public c()
  {
    d(false);
    f(false);
    g(new a.f.c.a());
    e(true);
    this.F = new a.f.h.k();
    a(25);
  }
  
  public boolean a()
  {
    return this.G;
  }
  
  public void h(boolean paramBoolean)
  {
    this.G = paramBoolean;
  }
  
  public void a(a.f.h.a.a.b paramb)
  {
    this.w = paramb;
  }
  
  public a.f.h.k s()
  {
    return this.F;
  }
  
  public void a(a.f.h.k paramk)
  {
    this.F = paramk;
  }
  
  public void a(int paramInt)
  {
    this.z = paramInt;
  }
  
  public int t()
  {
    return this.z;
  }
  
  public void b(int paramInt)
  {
    this.A = paramInt;
  }
  
  public int u()
  {
    return this.A;
  }
  
  public void i(boolean paramBoolean)
  {
    this.B = paramBoolean;
  }
  
  public boolean v()
  {
    return this.B;
  }
  
  public void j(boolean paramBoolean)
  {
    this.C = paramBoolean;
  }
  
  public boolean w()
  {
    return this.C;
  }
  
  public boolean b(a.f.o paramo)
  {
    return true;
  }
  
  public void a(a.f.o paramo)
  {
    int j = d.n;
    int i = d.m;
    this.y = paramo;
    this.E = new bb();
    this.D = new a.c.ab();
    this.E.a(this.y.v());
    this.D.a(this.y.w());
    a.c.k localk = this.y.c(a.f.h.i.w);
    n localn = db.b();
    Object localObject1 = this.y.w();
    while (((a.c.m)localObject1).e())
    {
      localObject2 = ((a.c.m)localObject1).a();
      if (j != 0) {
        break label187;
      }
      localObject3 = a((a.c.d)localObject2);
      if (i != 0) {
        break label186;
      }
      if (localObject3 != null) {
        localn.a(localObject2, ((a.f.h.k)localObject3).d());
      }
      ((a.c.m)localObject1).f();
      if (i != 0)
      {
        if (j == 0) {}
        a.c.q.n = !a.c.q.n;
      }
    }
    this.y.a(a.f.h.i.w, localn);
    label186:
    label187:
    localObject1 = this.y.C();
    Object localObject2 = this.y.c(oc.a);
    if (localObject2 != null)
    {
      localObject3 = paramo.w();
      do
      {
        if (!((a.c.m)localObject3).e()) {
          break;
        }
        localObject4 = ((a.c.m)localObject3).a();
        if (j != 0) {
          break label351;
        }
        localObject5 = (kc[])((a.c.k)localObject2).get(localObject4);
        if (i != 0) {
          break label341;
        }
        if ((j != 0) || (localObject5 != null))
        {
          localObject6 = a((Object[])localObject5);
          a.i.l.a((List)localObject6, new a_());
          ((n)localObject1).a(localObject4, localObject6);
        }
        ((a.c.m)localObject3).f();
      } while (i == 0);
    }
    if ((j == 0) && (j == 0)) {
      if (this.w == null) {
        this.w = j.a(this.y);
      }
    }
    label341:
    label351:
    Object localObject3 = this.y.c(a.f.c.i.e);
    if (localObject3 != null)
    {
      localObject4 = new h(this.y);
      localObject5 = this.y.v();
      do
      {
        if (!((w)localObject5).e()) {
          break;
        }
        localObject6 = ((w)localObject5).d();
        if (j != 0) {
          break label570;
        }
        localObject7 = this.w.a((e)localObject6);
        if (i != 0) {
          break label569;
        }
        if ((j != 0) || (localObject7 != null))
        {
          if (j != 0) {
            continue;
          }
          if (((a.f.h.a.a.f)localObject7).f())
          {
            if (j != 0) {
              continue;
            }
            if (((h)localObject4).e((e)localObject6))
            {
              localObject8 = (s)((a.c.k)localObject3).get(localObject6);
              localObject9 = this.y.u((e)localObject6);
              if (j != 0) {
                continue;
              }
              if (localObject8 != null) {
                this.y.b((e)localObject6, Math.max(((s)localObject9).a, ((s)localObject8).a), Math.max(((s)localObject9).b, ((s)localObject8).b));
              }
            }
          }
        }
        ((w)localObject5).f();
      } while (i == 0);
      if (j == 0) {
        ((h)localObject4).e();
      }
    }
    else
    {
      this.x = new a.f.h.a.b.b(this.y, this.w);
    }
    label569:
    label570:
    Object localObject4 = this.x.d().w();
    if (((a.c.m)localObject4).e()) {}
    for (;;)
    {
      if (j == 0)
      {
        this.x.m(((a.c.m)localObject4).a());
        ((a.c.m)localObject4).f();
        if (i == 0)
        {
          if (i == 0) {
            break;
          }
          if (j != 0) {
            continue;
          }
          a((n)localObject1, localn);
        }
      }
    }
    localObject4 = a.f.h.a.b.o.a(this.x.d(), this.x.b());
    Object localObject5 = ((a.c.ab)localObject4).l();
    if (((a.c.m)localObject5).e()) {}
    while (j != 0)
    {
      this.x.s(((a.c.m)localObject5).a());
      ((a.c.m)localObject5).f();
      if ((j == 0) && (i != 0)) {
        break label726;
      }
      if (i == 0) {
        break;
      }
    }
    a.f.h.a.b.l.a(this.x, (n)localObject1, localn);
    label726:
    localObject5 = new a.f.h.b.a();
    ((a.f.h.b.a)localObject5).a(this.z);
    ((a.f.h.b.a)localObject5).a(this.F);
    ((a.f.h.b.a)localObject5).e(false);
    ((a.f.h.b.a)localObject5).a(this.x);
    Object localObject6 = new a.f.h.a.b.i(this.x, this.D);
    ((a.f.h.a.b.i)localObject6).a(this.A);
    ((a.f.h.a.b.i)localObject6).b(this.C);
    ((a.f.h.a.b.i)localObject6).a(this.B);
    ((a.f.h.b.a)localObject5).a((a.f.j.m)localObject6);
    ((a.f.h.b.a)localObject5).d(false);
    Object localObject7 = new d(this.x, this.D);
    ((a.f.h.b.a)localObject5).a((a.f.h.b.d)localObject7);
    Object localObject8 = new f();
    ((f)localObject8).a(this.w);
    ((f)localObject8).a(this.x);
    ((a.f.h.b.a)localObject5).a((a.f.h.b.b)localObject8);
    Object localObject9 = new g();
    if (j == 0) {}
    ((g)localObject9).b(this.G ? 1 : 3);
    this.y.a(a.f.h.d.o.t, a.i.q.a(new Integer(5)));
    ((a.f.h.b.a)localObject5).a((a.f.h.b.l)localObject9);
    ((a.f.h.b.a)localObject5).k(this.y.c(oc.b) != null);
    ((a.f.h.b.a)localObject5).j(this.y.c(oc.a) != null);
    ((a.f.h.b.a)localObject5).a(new p((n)localObject1));
    ((a.f.h.b.a)localObject5).h(false);
    ((a.f.h.b.a)localObject5).i(false);
    ((a.f.h.b.a)localObject5).a(false);
    ((a.f.h.b.a)localObject5).doLayout(this.y);
    x();
    if (j == 0)
    {
      this.x.a();
      new hb().doLayout(this.y);
      if (localk != null)
      {
        this.y.a(a.f.h.i.w, localk);
        if (j != 0) {
          break label1119;
        }
        if (i == 0) {
          break label1094;
        }
      }
    }
    this.y.j(a.f.h.i.w);
    label1094:
    this.w = null;
    this.x = null;
    this.y = null;
    this.D = null;
    this.E = null;
    label1119:
    if (j != 0) {
      a.c.q.o = !a.c.q.o;
    }
  }
  
  private static ArrayList a(Object[] paramArrayOfObject)
  {
    int k = d.n;
    int j = d.m;
    ArrayList localArrayList = new ArrayList(paramArrayOfObject.length);
    do
    {
      for (int i = 0; j == 0; i++)
      {
        if (i >= paramArrayOfObject.length) {
          break;
        }
        if (j != 0) {
          break label52;
        }
        localArrayList.add(paramArrayOfObject[i]);
      }
    } while (k != 0);
    label52:
    return localArrayList;
  }
  
  void x()
  {
    int j = d.n;
    int i = d.m;
    a.c.m localm = this.y.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      a.c.d locald = localm.a();
      a.c.ab localab = this.x.B(locald);
      if (j == 0)
      {
        if (localab != null) {
          this.y.a(localab.m().f());
        }
        localm.f();
      }
    } while (i == 0);
  }
  
  private void a(n paramn1, n paramn2)
  {
    int j = d.n;
    int i = d.m;
    a.c.m localm = this.y.w();
    localm.i();
    do
    {
      if (!localm.e()) {
        break;
      }
      a.c.d locald1 = localm.a();
      if (j == 0)
      {
        if (locald1.e() != locald1.f())
        {
          a.f.h.a.a.g localg1 = this.w.a(locald1.e());
          a.f.h.a.a.g localg2 = this.w.a(locald1.f());
          a.f.h.a.a.g localg3 = (a.f.h.a.a.g)a.f.h.a.a.o.e(localg1, localg2);
          a.f.h.a.a.g localg4;
          e locale;
          a.f.h.a.a.g localg5;
          a.c.d locald2;
          a.c.d locald3;
          a.c.ab localab;
          if (j == 0) {
            if (localg3 == localg1)
            {
              localg4 = (a.f.h.a.a.g)localg1.a();
              locale = this.y.i();
              this.y.b(locale, 0.0D, 0.0D);
              localg5 = this.w.a(localg4, locale);
              localg4.b(localg5);
              locald2 = this.y.a(locald1.e(), locale);
              locald3 = this.y.a(locale, locald1.f());
              localab = new a.c.ab();
              localab.b(locald2);
              localab.b(locald3);
              a(locald1, localab, paramn1, false);
              a(locald1, localab, paramn2);
              this.x.c(locald1, localab);
              this.y.f(locald1);
              if (j != 0) {
                continue;
              }
            }
          }
          if ((i != 0) && ((j != 0) || (localg3 == localg2)))
          {
            localg4 = (a.f.h.a.a.g)localg2.a();
            locale = this.y.i();
            this.y.b(locale, 0.0D, 0.0D);
            localg5 = this.w.a(localg4, locale);
            localg4.b(localg5);
            locald2 = this.y.a(locald1.e(), locale);
            locald3 = this.y.a(locale, locald1.f());
            localab = new a.c.ab();
            localab.b(locald2);
            localab.b(locald3);
            a(locald1, localab, paramn1, false);
            a(locald1, localab, paramn2);
            this.x.c(locald1, localab);
            this.y.f(locald1);
          }
        }
        localm.g();
      }
    } while (i == 0);
  }
  
  private void a(a.c.d paramd, a.c.ab paramab, n paramn, boolean paramBoolean)
  {
    int j = d.n;
    int i = d.m;
    ArrayList localArrayList1 = (ArrayList)paramn.get(paramd);
    if ((j != 0) || (localArrayList1 != null))
    {
      if (j != 0) {
        break label53;
      }
      if (!localArrayList1.isEmpty()) {}
    }
    else
    {
      return;
    }
    label53:
    ArrayList localArrayList2 = new ArrayList();
    ArrayList localArrayList3 = new ArrayList();
    Iterator localIterator = localArrayList1.iterator();
    if (localIterator.hasNext()) {}
    label161:
    label223:
    do
    {
      kc localkc = (kc)localIterator.next();
      fd localfd = localkc.g();
      if ((j == 0) && (i != 0)) {
        return;
      }
      if (j == 0) {
        if (paramBoolean)
        {
          if (j == 0)
          {
            if (localfd.j())
            {
              localArrayList2.add(localkc);
              if (j != 0) {
                break label161;
              }
              if (i == 0) {
                break;
              }
            }
            localArrayList3.add(localkc);
          }
          if ((j == 0) && (i == 0)) {
            break;
          }
        }
      }
      if (j == 0)
      {
        if (!localfd.j())
        {
          if (j != 0) {
            break label223;
          }
          if (!localfd.k())
          {
            localArrayList3.add(localkc);
            if (j != 0) {
              break label223;
            }
            if (i == 0) {
              break;
            }
          }
        }
        localArrayList2.add(localkc);
      }
      if (i == 0) {
        break;
      }
      paramn.a(paramab.m(), localArrayList2);
    } while (j != 0);
    paramn.a(paramab.n(), localArrayList3);
  }
  
  private a.f.h.k a(a.c.d paramd)
  {
    int i = d.n;
    a.c.k localk = this.y.c(a.f.h.i.w);
    if (((i != 0) || (localk != null)) && ((i != 0) || (localk.get(paramd) != null))) {
      return (a.f.h.k)localk.get(paramd);
    }
    return this.F;
  }
  
  private void a(a.c.d paramd, a.c.ab paramab, n paramn)
  {
    int k = d.n;
    int j = d.m;
    a.f.h.k localk1 = (a.f.h.k)paramn.get(paramd);
    if (localk1 != null)
    {
      int i = 0;
      a.c.m localm = paramab.l();
      label230:
      do
      {
        if (!localm.e()) {
          break;
        }
        a.c.d locald = localm.a();
        a.f.h.k localk2 = (a.f.h.k)paramn.get(locald);
        if (k == 0) {
          if (localk2 != null)
          {
            double d1 = Math.max(localk2.c(), localk1.c());
            localk2.c(d1);
            if (k == 0) {
              if (i == 0)
              {
                d2 = Math.max(localk2.a(), localk1.a());
                localk2.a(d2);
              }
            }
            if (k != 0) {
              continue;
            }
            if (i != paramab.size() - 1) {
              break label230;
            }
            double d2 = Math.max(localk2.b(), localk1.b());
            localk2.b(d2);
            if (k != 0) {
              continue;
            }
            if (j == 0) {
              break label230;
            }
          }
        }
        localk2 = localk1.d();
        if (k == 0) {
          if (i > 0) {
            localk2.a(0.0D);
          }
        }
        if (i < paramab.size() - 1) {
          localk2.b(0.0D);
        }
        paramn.a(locald, localk2);
        localm.f();
        i++;
      } while (j == 0);
    }
  }
  
  protected void a(a.f.j.ab paramab)
  {
    int j = d.n;
    int i = d.m;
    w localw = paramab.a().v();
    label152:
    label154:
    do
    {
      do
      {
        if (!localw.e()) {
          return;
        }
        e locale = localw.d();
        System.out.println("\nNode [" + locale + "]: ");
        System.out.println("Outedges: ");
        a.c.m localm = locale.n();
        do
        {
          if (!localm.e()) {
            break;
          }
          System.out.println("\t" + localm.a());
          localm.f();
          if (j != 0) {
            break label154;
          }
          if (i != 0) {
            break label152;
          }
        } while (i == 0);
      } while (j != 0);
      localw.f();
    } while (i == 0);
  }
  
  protected void c(a.f.j.ab paramab)
  {
    int j = d.n;
    int i = d.m;
    System.out.println("\nFaces: \n------");
    do
    {
      a.f.j.o localo = paramab.b();
      while (i == 0)
      {
        if (!localo.e()) {
          break;
        }
        System.out.println(localo.a());
        localo.f();
      }
    } while (j != 0);
  }
  
  static class a_
    implements Comparator
  {
    private static final int a = 0;
    private static final int b = 1;
    private static final int d = 2;
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      int k = d.n;
      kc localkc1 = (kc)paramObject1;
      kc localkc2 = (kc)paramObject2;
      fd localfd1 = localkc1.g();
      fd localfd2 = localkc2.g();
      int i = a(localfd1);
      int j = a(localfd2);
      if (k == 0)
      {
        if (i < j) {
          return -1;
        }
        if (k != 0) {}
      }
      else if (i > j)
      {
        return 1;
      }
      return 0;
    }
    
    private int a(fd paramfd)
    {
      int i = d.n;
      if (i == 0) {
        if (paramfd.j()) {
          return 0;
        }
      }
      if (i == 0) {
        if (!paramfd.j())
        {
          if (i != 0) {
            break label42;
          }
          if (!paramfd.k()) {
            return 2;
          }
        }
      }
      label42:
      return 1;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.a.c

 * JD-Core Version:    0.7.0.1

 */